package day10;

import org.junit.Test;

public class StringTest {
	@Test
	public void test() {
		String str1 = "My name is Logan";
		String str2 = "My name is Victora";
		String str3 = "   aaa   ";
		System.out.println("字符串长度" + str1.length());
		System.out.println(str1.charAt(6));
		System.out.println(str1.indexOf("a"));
		System.out.println(str1.indexOf("a",6));
		System.out.println(str1.lastIndexOf("a"));
		System.out.println(str1.lastIndexOf("a", 10));
		System.out.println(str1.lastIndexOf("is"));
		System.out.println(str1.endsWith(str2));
		System.out.println(str1.contains("o"));
		System.out.println(str1.startsWith("My"));
		System.out.println(str1.startsWith("My", 8));
		System.out.println(str1.replace("Logan", "Victora"));
		System.out.println(str1.substring(5));
		System.out.println(str1.substring(5, 7));
		System.out.println(str3.trim());
	}
}
